<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 5. Image toolkit</a>
</td><td width="60%">
<p align="center">
=====================================<br />
5.8 Changing the color of a pixel<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
You can modify the colors of an image with :<br />
<p class="code"><pre>
C++ : TCODColor TCODImage::putPixel(int x, int y, const TCODColor col)
C   : void TCOD_image_put_pixel(TCOD_image_t image,int x, int y,TCOD_color_t col)
Py  : image_put_pixel(image,x, y,col)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>image</td><td>In the C version, the image handler, obtained with the <a href="image_load.html">load</a> function.</td></tr>
<tr><td>x,y</td><td>The pixel coordinates inside the image.<br />0 &lt;= x &lt; width<br />0 &lt;= y &lt; height<br /></td></tr>
<tr><td>col</td><td>The new color of the pixel.</td></tr>
</table>
Example :<br />
<p class="code"><pre>
C++ : TCODImage *pix = new TCODImage(80,50);
      pix->putPixel(40,25,TCODColor::white);
C   : TCOD_image_t pix = TCOD_image_new(80,50);
      TCOD_image_put_pixel(pix,40,25,TCOD_white);
Py  : pix = libtcod.image_new(80,50)
      libtcod.image_put_pixel(pix,40,25,libtcod.white)
</pre></p>
